const state = {
    // 当前页面头部信息
    headerData: {},
    // 地区联动 orgId
    orgId: '',
    // 标题名
    nowTitle: {}, 
    // 更新时间
    update: '',
    // 详细报表 -- 某些模块需要
    lineDetail: '',
    // 九宫格下面的完成率
    afterloanMajorData: {},
    // 地区下拉
    addressData: {},
    // 收藏地区下拉 
    startCondit: {},
    // 收藏内容 
    detailCondit: {},
    // 日期类型 
    period: {},
    // 页面加载完 
    isLoader: false,
    // 记录离开、进入时间
    time: '',
}

const mutations = {
    headerData (state, data) {
        state.headerData = data
    },  

    orgId (state, data) {
        state.orgId = data
    }, 

    nowTitle (state, data) {
        state.nowTitle = data
    },

    update (state, data) {
        state.update = data
    },

    lineDetail (state, data) {
        state.lineDetail = data
    }, 

    afterloanMajorData (state, data) {
        state.afterloanMajorData = data
    },

    startCondit (state, data) {
        state.startCondit = data
    }, 

    period (state, data) {
        state.period = data
    }, 

    addressData (state, data) {
        state.addressData = data
    }, 

    isLoader (state, data) {
        state.isLoader = data
    },

    detailCondit (state, data) {
        state.detailCondit = data
    },

    time (state, data) {
        state.time = data
    },
}

const getters = {
    headerData: state => {
        return state.headerData ? state.headerData : {}
    },
    orgId: state => {
        return state.orgId ? state.orgId : ''
    },
    nowTitle: state => {
        return state.nowTitle ? state.nowTitle : {quotaType: '', name: ''}
    },
    update: state => {
        return state.update ? state.update : ''
    },
    lineDetail: state => {
        return state.lineDetail ? state.lineDetail : ''
    },
    afterloanMajorData: state => {
        return state.afterloanMajorData ? state.afterloanMajorData : ''
    },
    startCondit: state => {
        return state.startCondit ? state.startCondit : {}
    },
    period: state => {
        return state.period ? state.period : {name: '', val: 1}
    },
    addressData: state => {
        return state.addressData ? state.addressData : {}
    },
    isLoader: state => {
        return state.isLoader ? state.isLoader : false
    },
    detailCondit: state => {
        return state.detailCondit ? state.detailCondit : false
    },
    time: state => {
        return state.time ? state.time : ''
    }
}

const actions = {
    //loginOut: ({ commit }) => commit(types.LOGIN_OUT),
}

export default {
    state,
    getters,
    mutations,
    actions
}